package units 
{
	public class CollideUnit extends Unit 
	{
		protected var collide:Boolean;
		
		private var d_x:Number;
		private var d_y:Number;
		private var d_hyp:Number;
		private var d_col:Number;
		
		
		public function setCollide(b:Boolean):void
		{
			collide = b;
		}
		
		public function isCollide():Boolean
		{
			return collide;
		}
		
		public function testCollide(other:CollideUnit):Boolean
		{
			d_x = get_x() - other.get_x();
			d_y = get_y() - other.get_y();
			
			d_hyp = Math.sqrt((d_x * d_x) + (d_y * d_y));
			d_col = (getRadius() / 2) + (other.getRadius() / 2);
			
			return d_hyp < d_col;
		}
		
	}

}